import java.sql.SQLException;

public class DBConnectionVoter extends  DBConnection {
    public DBConnectionVoter() throws SQLException {
        executeSQL("DROP TABLE IF EXISTS voter_count");
        executeSQL(new StringBuilder().append("CREATE TABLE voter_count(")
                        .append("id INT NOT NULL AUTO_INCREMENT, ")
                        .append("name VARCHAR(120) NOT NULL, ")
                        .append("birthDate DATE NOT NULL, ")
                        .append("`count` INT NOT NULL, ")
                        .append("PRIMARY KEY(id), ")
                        .append("UNIQUE KEY(name, birthDate))")
                        .append(getEngine() == null || getEngine().isBlank() ? "" : " ENGINE=" + getEngine())
                        .toString()
        );
    }
}
